﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbFactory
{
    public class ConnectionFactory
    {

        public static IDatabaseConnection createConnetction(string dbType)
        {
            switch (dbType)
            {
                //读写分离，高并发，分布式数据库，锁
                case "mysql":
                    return new MySQLConnection();
                case "sqlserver":
                    return new SQLServerConnection();
                default:
                    throw new Exception("未找到数据库类型："+dbType);
            }
        }

    }
}
